function doTime(type) {
	let timeObj = {};
	if (type == 1) {
		//console.log("今天");
		timeObj.s = new Date().setHours(0, 0, 0, 0); // 当天零点
		timeObj.e = Date.parse(new Date()); //当前时间
	} else if (type == 2) {
		console.log("本周");
		//当前时间到本周周一零点
		let todayZero = new Date().setHours(0, 0, 0, 0); // 当天零点
		//当天星期几，如果是周日为0，那么返回7，
		let nowDay = (new Date()).getDay() ? (new Date()).getDay() : 7;
		let timestamp = 24 * 60 * 60 * 1000; //时间戳转化系数
		timeObj.s = todayZero - (nowDay - 1) * timestamp; // 本周周一零点
		timeObj.e = Date.parse(new Date()); //当前时间
	} else if (type == 3) {
		console.log("上周");
		//上周一零点到上周日24点
		let timestamp = 24 * 60 * 60 * 1000;
		let nowDay = (new Date()).getDay() ? (new Date()).getDay() : 7;
		let todayZero = new Date().setHours(0, 0, 0, 0) // 当天零点
		let todayEnd = todayZero + timestamp //当前24点
		timeObj.s = todayZero - (nowDay + 6) * timestamp; //上周一零点
		timeObj.e = todayEnd - nowDay * timestamp; //上周日24点
	} else if (type == 4) {
		console.log("本月");
		//当前时间到本月一号零点
		let todayZero = new Date().setHours(0, 0, 0, 0); // 当天零点
		//当天是几号，
		let nowDay = (new Date()).getDate();
		let timestamp = 24 * 60 * 60 * 1000; //时间戳转化系数
		timeObj.s = todayZero - (nowDay - 1) * timestamp; // 本月一日零点
		timeObj.e = Date.parse(new Date()); //当前时间
	} else if (type == 5) {
		console.log('上月');
		//上月1号到上月最后一天(28\29\30\31)
		let timestamp = 24 * 60 * 60 * 1000;
		let nowDay = (new Date()).getDate(); //当天是几号
		let nowMonth = (new Date()).getMonth() + 1; //当前月份
		let todayZero = new Date().setHours(0, 0, 0, 0) // 当天零点
		let todayEnd = todayZero + timestamp //当前24点
		timeObj.e = todayEnd - nowDay * timestamp; // 本月一日零点
		//当前月有30天4、6、9、11
		if (nowMonth == 4 || nowMonth == 6 || nowMonth == 9 || nowMonth == 11) {
			timeObj.s = todayZero - ((nowDay - 2) + 30) * timestamp
		} else if (nowMonth == 2) {
			//当前月为2月判断是不是闰年
			if ((year % 4 === 0) && (year % 100 !== 0 || year % 400 === 0)) {
				//闰年2月有29天
				timeObj.s = todayZero - ((nowDay - 2) + 29) * timestamp
			} else {
				timeObj.s = todayZero - ((nowDay - 2) + 28) * timestamp
			}
		} else {
			//当前月有31天 1、3、5、7、8、10、12
			timeObj.s = todayZero - ((nowDay - 2) + 31) * timestamp
		}
	}
	return timeObj
}

export default {
	doTime
}